<!DOCTYPE html>
<html class="ui-page-login">

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>登录</title>
		<link href="css/mui.min.css" rel="stylesheet" />
		<link href="css/style.css" rel="stylesheet" />
		<link href="css/reg_style.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="css/common.css" />
		<style>
			.logo-login {
				width: 0.7rem;
				height: 0.7rem;
				margin: 0.7rem auto .5rem auto;
			}
			.mui-input-row label{
				padding-left: 0px;
				text-align: left;
				width: 12%;
			}
			.mui-input-row label~input, .mui-input-row label~select, .mui-input-row label~textarea{
				width: 88%;
			}
			.link-area.register{
				font-size: 0.15rem;
			}
			
		</style>
		
	</head>

	<body>
		<div class="mui-content">
			<div class="mui-content-padded content-box">
				<img class="logo-login" src="img/login.png" />
				<form id='login-form' class="mui-input-group">
					<div class="mui-input-row">
						<label><img class="input_logo_account" src="img/zh.png" /></label>
						<input oninput="if(value.length>11)value=value.slice(0,11)" onkeyup="judge_phone()" id='account' pattern="\d*" type="number" class="mui-input-clear mui-input" placeholder="请输入您的手机号码" value="" maxlength="11">
					</div>
					<div class="mui-input-row">
						<label><img class="input_logo_password" src="img/mm.png" /></label>
						<!--<input onkeyup="judge_phone()" id='password' type="password" data-input-password="2" class="mui-input-clear mui-input-password" placeholder="请输入您的密码^" value="" maxlength="16">-->
						<input onkeyup="judge_phone()" id='password' type="password" data-input-password="2" class="mui-input-clear mui-input-password" placeholder="请输入您的密码" value="" maxlength="16">
					</div>
				</form>
				<div class="link-area forgetPassword blue">
					<a id='forgetPassword' href="reg_user_find.html">忘记密码?</a>
				</div>
				<button onclick="user_login();" id='btn_login' class="mui-btn mui-btn-block mui-btn-primary" disabled="disabled" style="width: 110%;margin-left: -5%;">登录</button>

				<div class="link-area register">
					<a id='register' href="reg_user_join.html">注册</a>
				</div>

			</div>
			<div class="mui-content-padded oauth-area">

			</div>
		</div>
		<script src="js/mui.min.js"></script>
		<script src="js/mui.enterfocus.js"></script>
		<script src="js/app.js"></script>
		<script src="js/jquery.js"></script>
		<script type="text/javascript" src="js/jsencrypt.js"></script>
		<script src="js/md5.js"></script>
		<script src="js/crypto-js.js"></script>
		<script type="text/javascript" src="js/common.js"></script>
		<script>
			//判断是否登录过

			//登录成功，将用户信息进行本地载入
			user_info = JSON.parse(window.localStorage.getItem("user_info"));
			//console.log(storage);			
			//console.log(user_info);

			//如果本地缓存未清空，代表用户是直接关闭窗口
			if(user_info!=null && user_info.params_sbx != null) {
				var sbx = user_info.params_sbx;
				login_encrypt_md5(sbx);
				ajax_submit_before(url_host + 'user/login', 'user_login');
			}else{
				user_info={};
			}
			//如果本地有账号，代表用户是退出登录
			var id = storage["id"];
			if(id != null) {
				if(id.length == 11) {
					window.location.href = "reg_user_logined.html";
				}
			}

			//var res_login = 0;
			//判断手机号长度，是否正确
			function judge_phone() {
				var account = mui('#account')[0].value;
				var password = mui('#password')[0].value;

				if(account.length == 11 && password.length > 0) {
					document.getElementById("btn_login").disabled = false;
					//$("#btn_login").addClass("jianbian1");
					btn_login_se('jianbian3_shengse',"#btn_login");
				} else {

					document.getElementById("btn_login").disabled = true;
					//$("#btn_login").addClass("jianbian3");
					btn_login_se('jianbian1_qianse',"#btn_login");
				}

			}

			//登录前的参数对象RSA加密
			function user_login() {
				var sbx = {};
				sbx.id = mui("#account")[0].value;
				sbx.password = mui("#password")[0].value;
				sbx.password = md5(sbx.password);
				sbx.password = sbx.password.toLowerCase();

				//console.log(user_info.params_sbx);
				login_encrypt_md5(sbx);
				console.log(sbx);
				ajax_submit_before(url_host + 'user/login', 'user_login');

			}
		</script>
	</body>

</html>